package org.jeecg.modules.device.service.impl;

import org.apache.shiro.SecurityUtils;
import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.device.entity.DevDeviceRecord;
import org.jeecg.modules.device.mapper.DevDeviceRecordMapper;
import org.jeecg.modules.device.service.IDevDeviceRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.Arrays;

/**
 * @Description: 设备记录表
 * @Author: jeecg-boot
 * @Date:   2024-04-17
 * @Version: V1.0
 */
@Service
public class DevDeviceRecordServiceImpl extends ServiceImpl<DevDeviceRecordMapper, DevDeviceRecord> implements IDevDeviceRecordService {
    @Autowired
    private DevDeviceRecordMapper devDeviceRecordMapper;

    @Override
    public boolean batchFormEnable(String ids) {
        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
        String operator="";
        if(null != sysUser){
            operator=sysUser.getUsername();
        }
        return devDeviceRecordMapper.batchFormEnable(Arrays.asList(ids.split(",")),operator);
    }

    @Override
    public boolean batchFormDisable(String ids) {
        LoginUser sysUser = (LoginUser)SecurityUtils.getSubject().getPrincipal();
        String operator="";
        if(null != sysUser){
            operator=sysUser.getUsername();
        }
        return devDeviceRecordMapper.batchFormDisable(Arrays.asList(ids.split(",")),operator);
    }
}
